package com.gry.Test;

import java.util.ArrayList;

public class PhoneTest {
    public static void main(String[] args) {
        ArrayList<Phone>list = new ArrayList<>();
        Phone p1 = new Phone("小米", 2999);
        Phone p2 = new Phone("华为", 8999);
        Phone p3 = new Phone("苹果", 10999);
        list.add(p1);
        list.add(p2);
        list.add(p3);
        ArrayList<Phone> result = phoneInfo(list, 11000);
        for (int i = 0; i < result.size(); i++) {
            System.out.println(result.get(i).getBrand()+","+result.get(i).getPrice());
        }
    }
    public static ArrayList<Phone> phoneInfo(ArrayList<Phone>list, int price){
        ArrayList<Phone> result = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getPrice() < price){
                result.add(list.get(i));
            }
        }
        return result;
    }
}
